package com.bgs.service.impl;

import com.bgs.mapper.*;
import com.bgs.pojo.*;
import com.bgs.service.ruzhiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;
import java.util.List;

@Service
public class ruzhiServiceImpl implements ruzhiService {

    @Autowired
    private JoinJobMapper joinJobMapper;
    @Autowired
    private FamilyMapper familyMapper;
    @Autowired
    private ExperienceMapper experienceMapper;
    @Autowired
    private ProjectMapper projectMapper;
    @Autowired
    private SkillMapper skillMapper;
    @Autowired
    private WorkMapper workMapper;
    @Autowired
    private CertificateMapper certificateMapper;
    @Override
    public Boolean ruzhi(JoinJob job) {
        int i = 0;
        job.setIsDel(i);
        return joinJobMapper.ruzhi(job);
    }

    @Override
    public Boolean jiating(Family family) {
        int i = 0;
        Date date = new Date();
        Instant instant = date.toInstant();
        ZoneId zoneId = ZoneId.systemDefault();
        LocalDateTime localDateTime = instant.atZone(zoneId).toLocalDateTime();
        family.setCreateTime(localDateTime);
        family.setIsDel(i);
        return familyMapper.jiating(family);
    }

    @Override
    public Boolean jiaoyu(Experience experience) {
        int i = 0;
        Date date = new Date();
        Instant instant = date.toInstant();
        ZoneId zoneId = ZoneId.systemDefault();
        LocalDateTime localDateTime = instant.atZone(zoneId).toLocalDateTime();
        experience.setCreateTime(localDateTime);
        experience.setIsDel(i);
        return experienceMapper.jiaoyu(experience);
    }

    @Override
    public Boolean xiangmu(Project project) {
        int i = 0;
        project.setIsDel(i);
        return projectMapper.xiangmu(project);
    }

    @Override
    public Boolean jineng(Skill skill) {
        int i = 0;
        Date date = new Date();
        Instant instant = date.toInstant();
        ZoneId zoneId = ZoneId.systemDefault();
        LocalDateTime localDateTime = instant.atZone(zoneId).toLocalDateTime();
        skill.setCreateTime(localDateTime);
        skill.setIsDel(i);
        return skillMapper.jineng(skill);
    }

    @Override
    public Boolean gongzuo(Work work) {
        int i = 0;
        Date date = new Date();
        Instant instant = date.toInstant();
        ZoneId zoneId = ZoneId.systemDefault();
        LocalDateTime localDateTime = instant.atZone(zoneId).toLocalDateTime();
        work.setCreateTime(localDateTime);
        work.setIsDel(i);
        return workMapper.gongzuo(work);
    }

    @Override
    public List<JoinJob> findAll() {
        return joinJobMapper.findAll();
    }

    @Override
    public Boolean zhengshu(Certificate certificate) {
        int i = 0;
        Date date = new Date();
        Instant instant = date.toInstant();
        ZoneId zoneId = ZoneId.systemDefault();
        LocalDateTime localDateTime = instant.atZone(zoneId).toLocalDateTime();
        certificate.setCreateTime(localDateTime);
        certificate.setIsDel(i);
        return certificateMapper.zhengshu(certificate);
    }
}
